package a01demo1;

public class Test1 {
    public static void main(String[] args) {

        String regex1 = "1[3-9]\\d{9}";
        System.out.println("13112345678".matches(regex1));
        System.out.println("13172345678".matches(regex1));
        System.out.println("13112349678".matches(regex1));
        System.out.println("131123456718".matches(regex1));

        System.out.println("---------------");

        String regex2 = "0\\d{2,3}-?[1-9]\\d{4,9}";
        System.out.println("010-12345678".matches(regex2));
        System.out.println("010-123456789".matches(regex2));
        System.out.println("010-0234567890".matches(regex2));

        System.out.println("----------------");

        String regex3 = "\\w+@[\\w&&[^_]]{2,6}(\\.[a-zA-Z]{2,3}){1,2}";
        System.out.println("a01@163.com".matches(regex3));
        System.out.println("a01@1_63.com.cn".matches(regex3));
        System.out.println("a01@163.com.cn.cn".matches(regex3));

        System.out.println("------------------");
        String regex4="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
        System.out.println("12:34:56".matches(regex4));

        String regex5="([01]\\d|2[0-3])(:[0-5]\\d){2}";
        System.out.println("12:34:56".matches(regex5));

    }
}
